<?php
    
    //入口路由
    Route::get('/','Home\IndexController@index');
    //网站分类页路由
    Route::get('/list/{classify}/{num?}','Home\IndexController@list')->name('list');
    Route::get('/showGoods/{good}','Home\IndexController@showGoods')->name('showGoods');
    Route::get('/quickView/{good}','Home\IndexController@quickView')->name('quickView');
//根据前台异步发来的属性组合和商品id获取相应货品的数据和库存
    Route::get('getProduct/{attrs}/{id}','Goods\ProductController@getProduct')->name('getProduct');
    Route::post('getallowGoods/{classify}','Home\IndexController@getallowGoods')->name('getallowGoods');
    //订单模块
    Route::group(['middleware'=>[],'prefix'=>'order/','as'=>'order.','namespace'=>'Order'],function () {
    Route::get('/addOrder/weixin/{address}/{total}/{id}','OrderController@addOrder')->name('addOrder');
    Route::get('order/pay/{order}','OrderController@pay')->name('order.pay');
    Route::any('order/notify','OrderController@notify')->name('order.notify');
    Route::get('order/checkStatus/{id}','OrderController@checkStatus')->name('checkStatus');
    Route::get('order/paySuccess','OrderController@paySuccess')->name('paySuccess');
    Route::get('order/orderList','OrderController@orderList')->name('order.orderList');
//        Route::get('order/paySuccess','')
    });
    //购物车模块,
    Route::group(['middleware'=>['auth.login'],'prefix'=>'cart/','as'=>'cart.','namespace'=>'Cart'],function () {
       Route::get('/cart/addToCart/{good_id}/{product_id}/{number}/{attribute}','CartController@addToCart')->name('addToCart');
       Route::get('/cart/list','CartController@list')->name('cart.list');
       Route::get('/cart/removeCart/{id}','CartController@removeCart')->name('removeCart');
       Route::get('/changNum/{type}/{cart}','CartController@changNum')->name('cart.changNum');
       Route::get('/deleteCart/{cart}','CartController@deleteCart')->name('deleteCart');
       Route::get('/cart/settleAccounts/{id}/{total}','CartController@settleAccounts')->name('settleAccounts');
    });
    //收藏模块
    Route::group(['middleware'=>['auth.login'],'prefix'=>'collect/','as'=>'collect.','namespace'=>'Collect'],function () {
      Route::get('collect/clickCollect/{good}','CollectController@clickCollect')->name('clickCollect');
        Route::get('collect/offCollect/{good}','CollectController@offCollect')->name('offCollect');
        Route::get('collect/list','CollectController@list')->name('collect.list');
    });
    //足迹模块
    Route::group(['middleware'=>['auth.login'],'prefix'=>'track/','as'=>'track.','namespace'=>'Track'],function () {
       Route::get('/track','TrackController@index')->name('track.index');
    });
    //前台的登录注册,找回密码
    Route::group(['middleware'=>[],'prefix'=>'home/','as'=>'home.','namespace'=>'Home'],function (){
        Route::post('login/login','LoginController@login')->name('login.login');
        Route::get('login/loginFrom','LoginController@loginFrom')->name('login.loginFrom');
        Route::get('login/logout','LoginController@logout')->name('login.logout');
        Route::get('login/resignFrom','LoginController@resignFrom')->name('login.resignFrom');
        Route::post('login/resign','LoginController@resign')->name('login.resign');
        Route::get('login/resetFrom','LoginController@resetFrom')->name('login.resetFrom');
        Route::post('login/resetPassword','LoginController@resetPassword')->name('login.resetPassword');
    });
    Route::group(['middleware'=>['auth.login'],'prefix'=>'member/member','as'=>'member.member.','namespace'=>'Member'],function (){
        Route::get('index','MemberController@index')->name('index');
        Route::post('storeInfo','MemberController@storeInfo')->name('storeInfo');
        Route::post('icon','MemberController@icon')->name('icon');
        Route::get('iconFrom','MemberController@iconFrom')->name('iconFrom');
    });
    
    Route::group(['middleware'=>['auth.login'],'prefix'=>'member','as'=>'member.','namespace'=>'Member'],function (){
       Route::resource('members','IndexController');
    });
//******************************Admin模块**********************
/*
 * IndexController控制器
 */
Route::group(['middleware'=>['auth.admin'],'prefix'=>'admin/','as'=>'admin.','namespace'=>'Admin'],function (){
   Route::resource('/index','IndexController');
   Route::resource('administrator','AdministratorController');
});
Route::group(['middleware'=>[],'prefix'=>'admin/log','as'=>'admin.log.','namespace'=>'Admin'],function (){
    Route::get('/loginFrom','LogController@loginFrom')->name('loginFrom');
    Route::post('/login','LogController@login')->name('login');
});
Route::group(['middleware'=>['auth.admin'],'prefix'=>'admin/log','as'=>'admin.log.','namespace'=>'Admin'],function (){
    Route::get('/logout','LogController@logout')->name('logout');
});
//******************************Attribute模块**********************
Route::group(['middleware'=>['auth.admin'],'prefix'=>'attribute/','as'=>'attribute.','namespace'=>'Attribute'],function (){
    Route::resource('/attribute','AttributeController');
    Route::post('/attribute/attributeSon/{classify}','AttributeController@attributeSon')->name('attribute.attributeSon');
    
});
//******************************Classify模块**********************
Route::group(['middleware'=>['auth.admin'],'prefix'=>'classify/','as'=>'classify.','namespace'=>'Classify'],function (){
    Route::resource('/classify','ClassifyController');
    Route::post('/classify/classifySon/{classify}','ClassifyController@classifySon')->name('classify.classifySon');
});
//******************************Goods模块**********************
    Route::group(['middleware'=>['auth.admin'],'prefix'=>'goods/','as'=>'goods.','namespace'=>'Goods'],function (){
        Route::resource('/goods','GoodsController');
        Route::resource('product','ProductController');
    });
    //******************************Proxemics模块**********************
    Route::group(['middleware'=>['auth.admin'],'prefix'=>'proxemics/proxemics','as'=>'proxemics.proxemics.','namespace'=>'Proxemics'],function (){
        Route::get('/icon','ProxemicsController@icon')->name('icon');
        Route::post('/iconLoad','ProxemicsController@iconLoad')->name('iconLoad');
    });
    //******************************Util模块**********************
   Route::group(['prefix'=>'util/upload','as'=>'util.upload.','namespace'=>'Util'],function (){
   Route::any('/upload','UploadController@upload')->name('upload');
   });

//******************************Util模块**********************
    Route::group(['middleware'=>['auth.admin'],'prefix'=>'carousel/','as'=>'carousel.','namespace'=>'Carousel'],function (){
       Route::resource('carousel','CarouselController');
    });
    Route::group(['prefix'=>'member/','as'=>'member.','namespace'=>'Member'],function (){
        Route::resource('address','AddressController');
        Route::get('address/isDefault/{address}','AddressController@isDefault')->name('address.isDefault');
    });
